<?php
namespace App\Models\AmazonAds;

use Illuminate\Database\Eloquent\Model;
class AdsDailyReport extends Model
{
    protected $connection = 'mysql_amazon_ads';

    protected $table = 'ads_daily_report';

    protected $guarded  = [];

    public static array $_timeUnit = [
        'DAILY' => 1,
        'SUMMARY' => 2
    ];

    public static array $_timeUnitOption = [
        1 => 'DAILY',
        2 => 'SUMMARY',
        3 => 'OTHER',
    ];

    public static array $_status = [
        'PENDING'    => self::STATUS_PENDING,   //Report is created and awaiting processing.
        'PROCESSING' => self::STATUS_PROCESSING,//Report is processing. Please wait.
        'COMPLETED'  => self::STATUS_COMPLETED, //Report has completed. Check the url for the output file.
        'FAILED'     => self::STATUS_FAILED,    //Report generation failed. Check the failureReason for details.
    ];

    //创建报告状态
    const STATUS_PENDING    = 1; //待处理
    const STATUS_PROCESSING = 2; //处理中
    const STATUS_COMPLETED  = 3; //已完成
    const STATUS_FAILED     = 4; //请求失败，查找原因并重新请求
    const STATUS_ERROR      = 5; //请求过程中产生了错误，需要重新请求
    public static array $_createReportStatus = [
        self::STATUS_PENDING    => 'PENDING',
        self::STATUS_PROCESSING => 'PROCESSING',
        self::STATUS_COMPLETED  => 'COMPLETED',
        self::STATUS_FAILED     => 'FAILED',
        self::STATUS_ERROR      => 'ERROR',
    ];

    //下载&解析报告状态
    const PARSE_NO    = 0; //未解析
    const PARSE_YES   = 1; //解析正常
    const PARSE_ERROR = 2; //解析异常
    public static array $_downloadParseStatus = [
        self::PARSE_NO => '待下载&解析报告',
        self::PARSE_YES => '报告下载&解析正常',
        self::PARSE_ERROR => '报告下载&解析异常'
    ];

    //报告参数类型
    public static array $_adsType = [
        'spAdvertisedProduct' => 'SP_AP',//商品推广SP_推广的商品AP
        'sdAdvertisedProduct' => 'SD_AP',//展示型推广SD_推广的商品AP
        'sbCampaigns' => 'SB_C',//品牌推广SD_广告活动C
        'stCampaigns' => 'ST_C',//品牌推广视频ST_广告活动C
    ];

    public static array $_adsTypeParamType = ['name','startDate','endDate'];//每个报告类型的必填参数类型

}
